import { Navigate } from '@umijs/max';
import { useState } from 'react';
import { JSX } from 'react/jsx-runtime';

const withAuth = (Component: () => JSX.Element) => () => {
  // const { isLogin } = useAuth();
  const [isLogin] = useState(true);
  if (isLogin) {
    return <Component />;
  } else {
    return <Navigate to="/" />;
  }
};

export default withAuth;
